#include<stdio.h>
//得出n的位数
int acount(int n) {
	int count = 1;
	while ( n / 10 != 0) {
		n /= 10;
		count++;
	}
	return count;
}
//得到n的count次方
int mul(int n, int count) {
	int product = 1 ;
	while (count > 0) {
		product *= n ;
		count--;
	}
	return product ;
}
//得到每位数的count次方和
int asum(int n, int count ) {
	if (n > 9) {
		return ( mul( n % 10, count ) + asum(n / 10, count ) );
	}
}
int main() {
	int count = 0;
	printf("1 ");
	for (int n = 11 ; n <= 100000 ; n++) {
		count = acount( n );
		int sum = asum( n, count );
		if (n == sum) {
			printf("%d ", n);
		}
	}
	return 0;
}
